package com.umgsai.thread.thread09;

public class Service {
	private String username;
	private String password;
	public void setValue(String usernameParam, String passwordParam) {
		try {
			String anyString = new String();
			synchronized (anyString) {
				System.out.println(Thread.currentThread().getName() + "在" + System.currentTimeMillis() + "进入同步块");
				username = usernameParam;
				Thread.sleep(3000);
				password = passwordParam;
				System.out.println(Thread.currentThread().getName() + "在" + System.currentTimeMillis() + "离开同步块");
				System.out.println(username + "-" + password);
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
